package com.huawei.Galenus.service.impl;

import com.huawei.Galenus.dao.UserProposalRepository;
import com.huawei.Galenus.domain.UserProposal;
import com.huawei.Galenus.service.UserProposalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("UserProposalService")
public class UserProposalServiceImpl implements UserProposalService {

    @Autowired
    private UserProposalRepository userProposalRepository;

    @Override
    public Integer vote(Integer uid, Integer pid, Double amount) {
        UserProposal userProposal = new UserProposal();
        userProposal.setPid(pid);
        userProposal.setUid(uid);
        userProposal.setAmount(amount);
        return userProposalRepository.save(userProposal);
    }
}
